<?php defined('IN_IA') or exit('Access Denied');?><?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/header', TEMPLATE_INCLUDEPATH)) : (include template('common/header', TEMPLATE_INCLUDEPATH));?>
<ul class="nav nav-tabs">
    <li <?php  if($op=='list' ) { ?> class="active" <?php  } ?>>
        <a href="<?php  echo $this->createWebUrl('order', array('op' => 'list'));?>">订单列表</a>
    </li>
	<?php  if($op=='detail' ) { ?>
	<li <?php  if($op=='detail' ) { ?> class="active" <?php  } ?>>
        <a href="<?php  echo $this->createWebUrl('order', array('op' => 'list'));?>">订单<?php  if($settings['money_is_open']!=1) { ?>佣金<?php  } ?><?php  if($settings['money_is_open']!=1&&$settings['credit_is_open']!=1) { ?>/<?php  } ?><?php  if($settings['credit_is_open']!=1) { ?>积分<?php  } ?>分配明细</a>
    </li>
	<?php  } ?>
</ul>
<?php  if($op=='list') { ?>
<div class="panel panel-info">
        <div class="panel-heading">更新订单</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form2">
				<div class="form-group">
					<label class="col-xs-12 col-sm-1 control-label" style="width: 6%;">更新时间：</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">
						<?php  echo tpl_form_field_date('order_time',$order_time, $withtime = false);?>
					</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 5%;">选择平台</label>
					<div class="col-sm-2 col-xs-12" style="width: 13%;">
					    <input type="hidden" name="c" value="site" />
						<input type="hidden" name="a" value="entry" />
						<input type="hidden" name="m" value="<?php  echo $this->modulename?>" />
						<input type="hidden" name="do" value="get_order" />
                        <select name="pt1" id="sid" class="form-control">
						    <option value="" <?php  if(!$_GPC['pt1']) { ?>selected="selected"<?php  } ?>></option>
							<option value="8" <?php  if($_GPC['pt1']=='8') { ?>selected="selected"<?php  } ?>>聚推客联盟</option>
                            <option value="3" <?php  if($_GPC['pt1']=='3') { ?>selected="selected"<?php  } ?>>美团联盟（官方）</option>
							<option value="2" <?php  if($_GPC['pt1']=='2') { ?>selected="selected"<?php  } ?>>美团分销联盟（官方）</option>
                            <option value="4" <?php  if($_GPC['pt1']=='4') { ?>selected="selected"<?php  } ?>>淘宝联盟（含饿了么）</option>
							<option value="5" <?php  if($_GPC['pt1']=='5') { ?>selected="selected"<?php  } ?>>京东</option>
							<option value="6" <?php  if($_GPC['pt1']=='6') { ?>selected="selected"<?php  } ?>>拼多多</option>
							<option value="7" <?php  if($_GPC['pt1']=='7') { ?>selected="selected"<?php  } ?>>唯品会</option>
							<option value="1" <?php  if($_GPC['pt1']=='1') { ?>selected="selected"<?php  } ?>>订单侠</option>
                        </select>
                    </div>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label" id="sid_1" style="width: 5%;display:none;">折淘客sid：</label>
					<div class="col-sm-2 col-xs-12" id="sid_2" style="width: 8%;display:none;">
						<input type="text" name="sid" class="form-control" value="<?php  echo $settings['sid'];?>" />
						<span class="help-block" style="color:red;">*默认为淘宝api参数的sid，其他sid请自行修改</span>
					</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 10%;display:none;" id="sid_3">普通订单/渠道订单</label>
					<div class="col-sm-2 col-xs-12" style="width: 8%;display:none;" id="sid_4">
                        <select name="order_scene" id="sid" class="form-control">
						    <option value="" <?php  if(!$_GPC['order_scene']) { ?>selected="selected"<?php  } ?>></option>
							<option value="1" <?php  if($_GPC['order_scene']=='1') { ?>selected="selected"<?php  } ?>>普通订单</option>
                            <option value="2" <?php  if($_GPC['order_scene']=='2') { ?>selected="selected"<?php  } ?>>渠道订单</option>
                        </select>
                    </div>
					<div class="col-md-4 mathyts">
						<button type="submit" class="btn btn-primary"><i class="fa fa-refresh"></i>更新订单</button>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-heading">发放佣金/积分</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form3">
				<div class="form-group">
				    <label class="col-xs-12 col-sm-1 control-label" style="width: 5%;">选择平台</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">
					    <input type="hidden" name="c" value="site" />
						<input type="hidden" name="a" value="entry" />
						<input type="hidden" name="m" value="<?php  echo $this->modulename?>" />
						<input type="hidden" name="do" value="settlement_order" />
                        <select name="pingtai1" class="form-control" id="pingtai11">
						    <option value="" <?php  if(!$_GPC['pingtai1']) { ?>selected="selected"<?php  } ?>></option>
							<option value="美团外卖" <?php  if($_GPC['pingtai1']=='美团外卖') { ?>selected="selected"<?php  } ?>>美团外卖</option>
							<option value="美团闪购" <?php  if($_GPC['pingtai1']=='美团闪购') { ?>selected="selected"<?php  } ?>>美团闪购</option>
							<option value="美团团购" <?php  if($_GPC['pingtai1']=='美团团购') { ?>selected="selected"<?php  } ?>>美团团购</option>
							<option value="美团酒店" <?php  if($_GPC['pingtai1']=='美团酒店') { ?>selected="selected"<?php  } ?>>美团酒店</option>
							<option value="美团优选" <?php  if($_GPC['pingtai1']=='美团优选') { ?>selected="selected"<?php  } ?>>美团优选</option>
							<option value="饿了么" <?php  if($_GPC['pingtai1']=='饿了么') { ?>selected="selected"<?php  } ?>>饿了么</option>
							<option value="电影票" <?php  if($_GPC['pingtai1']=='电影票') { ?>selected="selected"<?php  } ?>>电影票</option>
							<option value="肯德基" <?php  if($_GPC['pingtai1']=='肯德基') { ?>selected="selected"<?php  } ?>>肯德基</option>
							<option value="麦当劳" <?php  if($_GPC['pingtai1']=='麦当劳') { ?>selected="selected"<?php  } ?>>麦当劳</option>
							<option value="京东" <?php  if($_GPC['pingtai1']=='京东') { ?>selected="selected"<?php  } ?>>京东</option>
							<option value="拼多多" <?php  if($_GPC['pingtai1']=='拼多多') { ?>selected="selected"<?php  } ?>>拼多多</option>
							<option value="唯品会" <?php  if($_GPC['pingtai1']=='唯品会') { ?>selected="selected"<?php  } ?>>唯品会</option>
							<option value="淘宝" <?php  if($_GPC['pingtai1']=='淘宝') { ?>selected="selected"<?php  } ?>>淘宝</option>
							<option value="天猫" <?php  if($_GPC['pingtai1']=='天猫') { ?>selected="selected"<?php  } ?>>天猫</option>
							<option value="百果园" <?php  if($_GPC['pingtai1']=='百果园') { ?>selected="selected"<?php  } ?>>百果园</option>
							<option value="奈雪的茶" <?php  if($_GPC['pingtai1']=='奈雪的茶') { ?>selected="selected"<?php  } ?>>奈雪的茶</option>
							<option value="瑞幸咖啡" <?php  if($_GPC['pingtai1']=='瑞幸咖啡') { ?>selected="selected"<?php  } ?>>瑞幸咖啡</option>
							<option value="星巴克" <?php  if($_GPC['pingtai1']=='星巴克') { ?>selected="selected"<?php  } ?>>星巴克</option>
							<option value="其他" <?php  if($_GPC['pingtai1']=='其他') { ?>selected="selected"<?php  } ?>>其他</option>
                        </select>
                    </div>
					<div class="col-md-4 mathyts">
						<button type="submit" class="btn btn-primary"><i class="fa fa-refresh"></i>发放<?php  if($settings['money_is_open']!=1) { ?>佣金<?php  } ?><?php  if($settings['money_is_open']!=1&&$settings['credit_is_open']!=1) { ?>/<?php  } ?><?php  if($settings['credit_is_open']!=1) { ?>积分<?php  } ?></button>
						<span class="help-block" style="color:red;">*请根据各个平台结算规则手动发放<?php  if($settings['money_is_open']!=1) { ?>佣金<?php  } ?><?php  if($settings['money_is_open']!=1&&$settings['credit_is_open']!=1) { ?>/<?php  } ?><?php  if($settings['credit_is_open']!=1) { ?>积分<?php  } ?>给用户；</span>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="<?php  echo $this->modulename?>" />
				<input type="hidden" name="do" value="order" />
				

                
				<div class="form-group">
				    
					<label class="col-xs-12 col-sm-1 control-label" style="width: 6%;">订单付款日期</label>
					<div class="col-sm-2 col-xs-12" style="width: 18%;"><?php  echo tpl_form_field_daterange('daterange', $daterange)?></div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 4%;">订单号</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">
						<input class="form-control" name="keyword2" id="" type="text" value="<?php  echo $_GPC['keyword2'];?>" placeholder="根据订单号搜索">
					</div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 2%;">平台</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">

                        <select name="keyword1" class="form-control" id="pingtai1">

						    <option value="" >全部</option>

							<option value="jutuike" <?php  if($_GPC['keyword1']=='jutuike') { ?>selected="selected"<?php  } ?>>聚推客联盟</option>

                           <option value="meituan" <?php  if($_GPC['keyword1']=='meituan') { ?>selected="selected"<?php  } ?>>美团联盟</option>

							 <option value="fenxiao" <?php  if($_GPC['keyword1']=='fenxiao') { ?>selected="selected"<?php  } ?>>美团分销联盟</option>

                            <option value="elm" <?php  if($_GPC['keyword1']=='elm') { ?>selected="selected"<?php  } ?>>饿了么</option>

							<option value="movie" <?php  if($_GPC['keyword1']=='movie') { ?>selected="selected"<?php  } ?>>电影票</option>

							<option value="jd" <?php  if($_GPC['keyword1']=='jd') { ?>selected="selected"<?php  } ?>>京东</option>

							<option value="pdd" <?php  if($_GPC['keyword1']=='pdd') { ?>selected="selected"<?php  } ?>>拼多多</option>

							<option value="wph" <?php  if($_GPC['keyword1']=='wph') { ?>selected="selected"<?php  } ?>>唯品会</option>

							<option value="tb" <?php  if($_GPC['keyword1']=='tb') { ?>selected="selected"<?php  } ?>>淘宝联盟</option>

							

                        </select>

                    </div>
					<label class="col-xs-12 col-sm-1 control-label" id="pingtai2_1" style="width: 5%;">选择类型</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;" id="pingtai2_2">
                        <select name="pingtai2" class="form-control">
						    <option value="" <?php  if(!$_GPC['pingtai2']) { ?>selected="selected"<?php  } ?>>全部</option>
                            <option value="美团外卖" <?php  if($_GPC['pingtai2']=='美团外卖') { ?>selected="selected"<?php  } ?>>美团外卖</option>
							<option value="美团闪购" <?php  if($_GPC['pingtai2']=='美团闪购') { ?>selected="selected"<?php  } ?>>美团闪购</option>
							<option value="美团团购" <?php  if($_GPC['pingtai2']=='美团团购') { ?>selected="selected"<?php  } ?>>美团团购</option>
							<option value="美团酒店" <?php  if($_GPC['pingtai2']=='美团酒店') { ?>selected="selected"<?php  } ?>>美团酒店</option>
							<option value="美团优选" <?php  if($_GPC['pingtai2']=='美团优选') { ?>selected="selected"<?php  } ?>>美团优选</option>
							<option value="饿了么" <?php  if($_GPC['pingtai2']=='饿了么') { ?>selected="selected"<?php  } ?>>饿了么</option>
							<option value="电影票" <?php  if($_GPC['pingtai2']=='电影票') { ?>selected="selected"<?php  } ?>>电影票</option>
							<option value="肯德基" <?php  if($_GPC['pingtai2']=='肯德基') { ?>selected="selected"<?php  } ?>>肯德基</option>
							<option value="麦当劳" <?php  if($_GPC['pingtai2']=='麦当劳') { ?>selected="selected"<?php  } ?>>麦当劳</option>
							<option value="京东" <?php  if($_GPC['pingtai2']=='京东') { ?>selected="selected"<?php  } ?>>京东</option>
							<option value="拼多多" <?php  if($_GPC['pingtai2']=='拼多多') { ?>selected="selected"<?php  } ?>>拼多多</option>
							<option value="唯品会" <?php  if($_GPC['pingtai2']=='唯品会') { ?>selected="selected"<?php  } ?>>唯品会</option>
							<option value="淘宝" <?php  if($_GPC['pingtai2']=='淘宝') { ?>selected="selected"<?php  } ?>>淘宝</option>
							<option value="天猫" <?php  if($_GPC['pingtai2']=='天猫') { ?>selected="selected"<?php  } ?>>天猫</option>
							<option value="百果园" <?php  if($_GPC['pingtai2']=='百果园') { ?>selected="selected"<?php  } ?>>百果园</option>
							<option value="奈雪的茶" <?php  if($_GPC['pingtai2']=='奈雪的茶') { ?>selected="selected"<?php  } ?>>奈雪的茶</option>
							<option value="瑞幸咖啡" <?php  if($_GPC['pingtai2']=='瑞幸咖啡') { ?>selected="selected"<?php  } ?>>瑞幸咖啡</option>
							<option value="星巴克" <?php  if($_GPC['pingtai2']=='星巴克') { ?>selected="selected"<?php  } ?>>星巴克</option>
							<option value="其他" <?php  if($_GPC['pingtai2']=='其他') { ?>selected="selected"<?php  } ?>>其他</option>
                        </select>
                    </div>
					<label class="col-xs-12 col-sm-1 control-label" style="width: 5%;">订单状态</label>
					<div class="col-sm-2 col-xs-12" style="width: 10%;">

                        <select name="keyword3" class="form-control">

						    <option value="" >全部</option>

                            <option value="1" <?php  if($_GPC['keyword3']=='1') { ?>selected="selected"<?php  } ?>>已付款</option>

							<option value="2" <?php  if($_GPC['keyword3']=='2') { ?>selected="selected"<?php  } ?>>平台已结算</option>

                            <option value="3" <?php  if($_GPC['keyword3']=='3') { ?>selected="selected"<?php  } ?>>已发放给用户</option>

							<option value="4" <?php  if($_GPC['keyword3']=='4') { ?>selected="selected"<?php  } ?>>已付款+已结算</option>

							<option value="5" <?php  if($_GPC['keyword3']=='5') { ?>selected="selected"<?php  } ?>>已取消</option>

                        </select>

                    </div>
					<div>
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
						<button type="button" class="btn btn-default">总记录数：<?php  echo $total;?></button>
					</div>
				</div>
			</form>
		</div>
		<div class="panel-heading" style="color: #000000;background-color: #ffca81;border-color: #f98000;">数据统计</div>
		<div class="panel-body">
		    <div class="col-sm-5" style="width: 100%;">
			    <label class="col-xs-12 col-sm-1 control-label" style="width: 33%;">总佣金收益：<b style="color:red;"><?php  echo round($allyjsql['order_profit1'],2)?></b></label>
				<label class="col-xs-12 col-sm-1 control-label" style="width: 33%;">已分配佣金：<b style="color:red;"><?php  echo round($allfxyjsql['c_11']+$allfxyjsql['c_21']+$allfxyjsql['c_31']+$allfxyjsql['c_t1']+$allfxyjsql['c_2t1']+$allfxyjsql['c_1h1']+$allfxyjsql['c_2h1']+$allfxyjsql['c_3h1']+$allfxyjsql['c_4h1'],2)?></b></label>
				<label class="col-xs-12 col-sm-1 control-label" style="width: 33%;">结余佣金收益：<b style="color:red;"><?php  echo round($allyjsql['order_profit1']-($allfxyjsql['c_11']+$allfxyjsql['c_21']+$allfxyjsql['c_31']+$allfxyjsql['c_t1']+$allfxyjsql['c_2t1']+$allfxyjsql['c_1h1']+$allfxyjsql['c_2h1']+$allfxyjsql['c_3h1']+$allfxyjsql['c_4h1']),2)?></b></label>
			</div>
		</div>
</div>
<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
    <div style="padding:15px;">
        <table class="table table-hover table-condensed">
            <thead class="navbar-inner">
                <tr>
                    <tr>

                    <th>id</th>

                    <th>平台</th>

					<th>类型</th>

                    <th>状态</th>

					<th>用户</th>

					<th>用户UID</th>

					<th>订单号</th>

					 <th>订单金额</th>

					 <th>订单佣金</th>

					 <th>已分配<?php  if($settings['money_is_open']!=1) { ?>佣金<?php  } ?><?php  if($settings['money_is_open']!=1&&$settings['credit_is_open']!=1) { ?>/<?php  } ?><?php  if($settings['credit_is_open']!=1) { ?>积分<?php  } ?></th>

					 <th>结余佣金</th>

                    <th>商品名</th>

                    <th>付款时间</th>

					<th style="text-align:right;">操作</th>

                </tr>
            </thead>
                <tbody id="level-list">

                <?php  if(is_array($list)) { foreach($list as $item) { ?>
                <tr>

                    <td><?php  echo $item['id'];?></td>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>

					

					

					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
					       if(!$item['c_1_uid']){$item['c_1_uid'] = $item['c1_uid'];}
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_1_uid'],'system_id' => $settings['system_id']));
					   }else{
					       if(!$item['c_1_uid']){$item['c_1_uid'] = $item['c1_uid'];}
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_1_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>

                        <img style="width: 40px;" src="<?php  echo $user['avatar'];?>">

                        <?php  echo $user['nickname'];?>

                    </td>

					<td><?php  echo $user['uid'];?></td>

					<td><?php  echo $item['order_id'];?></td>

					<td>￥<?php  echo $item['order_price'];?></td>

					<td>￥<?php  echo $item['order_profit'];?></td>

					<td><?php  if($settings['money_is_open']!=1) { ?>￥<?php  echo round($item['c_1']+$item['c_2']+$item['c_3']+$item['c_t']+$item['c_h']+$item['c_2t']+$item['c_1h']+$item['c_2h']+$item['c_4h']+$item['c_3h'],2)?><?php  } ?><?php  if($settings['money_is_open']!=1&&$settings['credit_is_open']!=1) { ?>/<?php  } ?><?php  if($settings['credit_is_open']!=1) { ?><?php  echo round($item['c_1_c']+$item['c_2_c']+$item['c_3_c']+$item['c_t_c']+$item['c_h_c']+$item['c_2t_c']+$item['c_1h_c']+$item['c_2h_c']+$item['c_4h_c']+$item['c_3h_c'],0)?>积分<?php  } ?></td>

					<td>￥<?php  echo round($item['order_profit']-$item['c_1']-$item['c_2']-$item['c_3']-$item['c_t']-$item['c_h']-$item['c_2t']-$item['c_1h']-$item['c_2h']-$item['c_4h']-$item['c_3h'],2)?></td>

					<td><?php  echo $item['goods_title'];?></td>

					<td><div class="type-parent"><?php  if($item['order_status'] == 1 || $item['order_status'] == 3 || $item['order_status'] == 8 || $item['order_status'] == 12 || $item['order_status'] == 14 || $item['order_status'] == 16 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 101 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?><?php  echo date('Y-m-d H:i:s',$item['order_paid_time'])?><?php  } ?></div></td>

					<td style="text-align:right;">
					    <a class="btn btn-primary btn-xs" href="<?php  echo $this->createWebUrl('order',array('op'=>detail,'id'=>$item['id']))?>"><?php  if($settings['money_is_open']!=1) { ?>佣金<?php  } ?><?php  if($settings['money_is_open']!=1&&$settings['credit_is_open']!=1) { ?>/<?php  } ?><?php  if($settings['credit_is_open']!=1) { ?>积分<?php  } ?>明细</a>
                        <a class="btn btn-default btn-sm" href="<?php  echo $this->createWebUrl('order',array('op'=>del,'id'=>$item['id']))?>"     onclick="return confirm('确认删除此订单吗？');return false;" title="删除">删除</a>

                    </td>


                </tr>
                <?php  } } ?>
            </tbody>
        </table>
        <?php  echo $pager;?>
    </div>
</form>
<script>
$('#pingtai1').change(function(){
    var data= $(this).val();
    if(data == 'jutuike'){
		$("#pingtai2_1").show();
		$("#pingtai2_2").show();
	}else{
		$("#pingtai2_1").hide();
		$("#pingtai2_2").hide();
	}
});
$('#sid').change(function(){
    var data= $(this).val();
    if(data == 4){
		$("#sid_1").show();
		$("#sid_2").show();
		$("#sid_3").show();
		$("#sid_4").show();
	}else{
		$("#sid_1").hide();
		$("#sid_2").hide();
		$("#sid_3").hide();
		$("#sid_4").hide();
	}
});
</script>
<?php  } else if($op=='detail') { ?>
<form action="" class="form-horizontal form" method="post" enctype="multipart/form-data">
    <div style="padding:15px;">
        <table class="table table-hover table-condensed">
            <thead class="navbar-inner">
                <tr>
                    <tr>

                    <th>平台</th>

					<th>类型</th>

                    <th>状态</th>

					<th>用户</th>

					<th>用户UID</th>

					<th>订单号</th>

					 <th>订单金额</th>

					 <th>订单佣金</th>

					 <th>分配佣金</th>

					 <th>分配积分</th>

					 <th>级别</th>

                </tr>
            </thead>
                <tbody id="level-list">

                <?php  if($item['c_1'] > 0 || $item['c_1_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_1_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_1_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_1'];?></td>
					<td><?php  echo $item['c_1_c'];?>积分</td>
					<td>自购/自推</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_2'] > 0 || $item['c_2_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_2_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_2_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_2'];?></td>
					<td><?php  echo $item['c_2_c'];?>积分</td>
					<td>普通会员直推</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_3'] > 0 || $item['c_3_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_3_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_3_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_3'];?></td>
					<td><?php  echo $item['c_3_c'];?>积分</td>
					<td>普通会员间推</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_t'] > 0 || $item['c_t_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_t_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_t_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_t'];?></td>
					<td><?php  echo $item['c_t_c'];?>积分</td>
					<td>团长/合伙人间推</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_2t'] > 0 || $item['c_2t_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_2t_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_2t_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_2t'];?></td>
					<td><?php  echo $item['c_2t_c'];?>积分</td>
					<td>团长间属团长</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_1h'] > 0 || $item['c_1h_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_1h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_1h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_1h'];?></td>
					<td><?php  echo $item['c_1h_c'];?>积分</td>
					<td>合伙人直属团长</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_2h'] > 0 || $item['c_2h_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_2h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_2h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_2h'];?></td>
					<td><?php  echo $item['c_2h_c'];?>积分</td>
					<td>合伙人间属团长</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_3h'] > 0 || $item['c_3h_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_3h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_3h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_3h'];?></td>
					<td><?php  echo $item['c_3h_c'];?>积分</td>
					<td>合伙人直属合伙人</td>
                </tr>
                <?php  } ?>
				<?php  if($item['c_4h'] > 0 || $item['c_4h_c'] > 0) { ?>
                <tr>
					<td><?php  if($item['pingtai'] == 'meituan') { ?>美团联盟<?php  } else if($item['pingtai'] == 'elm') { ?>饿了么<?php  } else if($item['pingtai'] == 'fenxiao') { ?>美团分销联盟<?php  } else if($item['pingtai'] == 'movie') { ?>电影票<?php  } else if($item['pingtai'] == 'jd') { ?>京东<?php  } else if($item['pingtai'] == 'pdd') { ?>拼多多<?php  } else if($item['pingtai'] == 'wph') { ?>唯品会<?php  } else if($item['pingtai'] == 'tb') { ?>淘宝联盟<?php  } else if($item['pingtai'] == 'jutuike') { ?>聚推客联盟<?php  } ?></td>

					<td><?php  echo $item['pingtai_name'];?></td>

					<?php  if($item['order_settlement_time'] > 0) { ?>

					<td>已发放</td>

					<?php  } else { ?>

					<td><?php  if($item['order_status'] == 8 || $item['order_status'] == 3 || $item['order_status'] == 14 || $item['order_status'] == 17 || $item['order_status'] == 18 || $item['order_status'] == 102 || $item['order_status'] == 103) { ?>已完成<?php  } ?><?php  if($item['order_status'] == 1 || $item['order_status'] == 12 || $item['order_status'] == 15 || $item['order_status'] == 101) { ?>已付款<?php  } ?><?php  if($item['order_status'] == 9 || $item['order_status'] == 13 || $item['order_status'] == 100 || $item['order_status'] == 104) { ?>已取消<?php  } ?></td>

					<?php  } ?>
					<td>
					<?php 
					   $user = array();
					   if($settings['system_type'] == 1){
				           $user = pdo_get($this->modulename . "_user_u", array("uid" => $item['c_4h_uid'],'system_id' => $settings['system_id']));
					   }else{
					       $user = pdo_get($this->modulename . "_user", array("uid" => $item['c_4h_uid'],'uniacid' => $_W['uniacid']));
					   }
				    ?>
					<img style="width: 40px;" src="<?php  echo $user['avatar'];?>"><?php  echo $user['nickname'];?>
                    </td>
					<td><?php  echo $user['uid'];?></td>
					<td><?php  echo $item['order_id'];?></td>
					<td>￥<?php  echo $item['order_price'];?></td>
					<td>￥<?php  echo $item['order_profit'];?></td>
					<td>￥<?php  echo $item['c_4h'];?></td>
					<td><?php  echo $item['c_4h_c'];?>积分</td>
					<td>合伙人间属合伙人</td>
                </tr>
                <?php  } ?>
            </tbody>
        </table>
        <?php  echo $pager;?>
    </div>
</form>
<?php  } ?>

<?php (!empty($this) && $this instanceof WeModuleSite || 1) ? (include $this->template('common/footer', TEMPLATE_INCLUDEPATH)) : (include template('common/footer', TEMPLATE_INCLUDEPATH));?>
